/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       textfileloader.h
 * Author:     twoja stara
 * Created on: 2009-06-17
 *
 **********************************************************************************************************************/

#ifndef TEXTFILELOADER_H_
#define TEXTFILELOADER_H_

#include "fileloader.h"
#include <fstream>

namespace mGameEngine
{

/**
 * Text file loader.
 * Used for loading unformatted text files.
 */
class TextFileLoader: public FileLoader
{
protected:
    /**
     * Loaded text.
     */
    String _text;

public:
    /**
     * Load text from specified file.
     * @param filename text file name to load.
     * @return loaded text.
     */
    static String loadTextFromFile(const String &filename);

    /**
     * Create empty text file loader.
     */
    TextFileLoader();

    /**
     * Create text file loader with specified file name.
     * @param filename text file name to load
     */
    TextFileLoader(const String &filename);

    /**
     * Destroy text file loader.
     */
    virtual ~TextFileLoader();

    /**
     * Load text from text file.
     */
    virtual void load();

    /**
     * Unload text file.
     */
    virtual void unload();

    /**
     * Get loaded text.
     * @return loaded text.
     */
    const String &getText() const
    {
        return _text;
    }
};

}

#endif // TEXTFILELOADER_H_
